{{#if (or (entityAction.hasBeforeLogics)(entityAction.hasAfterLogics)(eq entityAction.actionType 'DELOGIC'))}}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
    <process id="{{entityAction.actionLogicModel.bpmnDiagram.id}}" isClosed="false" isExecutable="true" name="{{entityAction.actionLogicModel.bpmnDiagram.name}}" processType="Private" tns:packageName="{{packageName}}.core.{{entityAction.entity.module}}.domain.{{entityAction.entity.codeName}}">
        <extensionElements>
        {{#each entityAction.actionLogicModel.bpmnDiagram.importParams as |param|}}
        <tns:import name="{{param.name}}" />
        {{/each}}
        {{#each entityAction.actionLogicModel.bpmnDiagram.globalParams as |param|}}
        <tns:global identifier="_{{param.identifier}}" type="{{param.type}}" />
        {{/each}}
        {{#each entityAction.actionLogicModel.bpmnDiagram.metadataParams as |param|}}
        <tns:metaData express="{{param.express}}" name="_{{param.name}}" type="{{param.type}}"/>
        {{/each}}
        </extensionElements>

    {{!-- 构造nodes循环输出 --}}
    {{#each entityAction.actionLogicModel.bpmnDiagram.nodes as |node|}}
        {{#if (eq logicNodeType 'BEGIN')}}
    <startEvent id="{{node.codeName}}" isInterrupting="true"/>
        {{else if (eq logicNodeType 'END')}}
    <endEvent id="{{node.codeName}}" name="{{node.name}}"/>
        {{else if (eq logicNodeType 'DELOGIC')}}
    {{!-- 附加行为类型为处理逻辑 --}}
    <callActivity activiti:exclusive="true" calledElement="{{node.refProcessId}}" id="{{node.codeName}}" name="/logic/{{node.logic.entity.codeName}}/{{node.logic.codeName}}.bpmn"/>
        {{else}}
    {{!-- 附加行为类型为实体行为 --}}
    <businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="{{node.globalCodeName}}" id="{{node.codeName}}" implementation="http://www.jboss.org/drools/rule" name="{{node.name}}"/>
        {{/if}}
    {{/each}}
    {{!-- 构造 links 对象，循环输出 --}}
    {{#each entityAction.actionLogicModel.bpmnDiagram.links}}
    <sequenceFlow id="{{sourceNodeId}}_{{targetNodeId}}" sourceRef="{{sourceNodeId}}" targetRef="{{targetNodeId}}"/>
    {{/each}}

</process>
</definitions>
{{/if}}